import Vue from 'vue';
import VueRouter from "vue-router";
Vue.use(VueRouter);
//1 创建组件
import Home from '../components/Home.vue';import News from "../components/News";import User from '../components/User';
import Content from "../components/Content";import UserAdd from "../components/user/UserAdd";
import UserList from "../components/user/UserList";
import User1 from "../components/User1";
import ceShiXiaLa from "../components/ceShiXiaLa";
import ceShiElementUI from "../components/ceShiElementUI";
import ceShiVuex from "../components/ceShiVuex/ceShiVuex";
import ceShiVuex001 from "../components/ceShiVuex/ceShiVuex001";
import ceShiVuex002 from "../components/ceShiVuex/ceShiVuex002";
//2 配置路由
const routes=[{path:'/home',component:Home},
  {path:'/ceShiVuex',component: ceShiVuex,
    children: [{path:'ceShiVuex001',component: ceShiVuex001},{path:'ceShiVuex002',component: ceShiVuex002}]
  },{
    path:'/user',component:User,
    children:[
      {path:'useradd',component:UserAdd},{path:'userlist',component:UserList}
    ]
  },
  {path:'/news',component:News,name:'news001'},
  {path:'/ceShiXiaLa',component:ceShiXiaLa},
  {path:'/ceShiElementUI',component:ceShiElementUI},
  {path:'/user1',component:User1},
  {path:'/content',component:Content}, {path:'*',redirect:'/home'}];
// 3 实例化vueRouter
const router=new VueRouter({
  mode:'hash',
  routes//相当于routes:routes  当key和vue一样的时候可以简写成一个
});
export default router;
